package com.nuoniu.sibanyun.controller.erp;

import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.dto.DynamicReportDto;
import com.nuoniu.sibanyun.service.erp.IErpReportDesignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;


/**
 * @ClassName ErpReportDesignController
 * @Description TODO
 * @Authpr baiqiang
 * @Date 2021/2/2 17:39
 **/
@RestController
@RequestMapping("/erp/reportDesign")
@Api(value = "ERP_报表设计",tags = "ERP_报表方案")
public class ErpReportDesignController extends BaseController {

    @Autowired
    private IErpReportDesignService erpReportDesignService;

    @PostMapping("/pageReport")
    @ApiOperation(value = "动态分页查询 报表")
    public HttpResult page(@RequestBody DynamicReportDto dynamicReportDto) {
        return HttpResult.ok(erpReportDesignService.pageReport(dynamicReportDto));
    }

    @ApiOperation("导出报表")
    @PostMapping("exportReport")
    public void exportReport(@RequestBody DynamicReportDto dynamicReportDto, HttpServletResponse response) {
        erpReportDesignService.exportReport(dynamicReportDto, response);
    }
}
